"use strict";
let add = function (a, b = 0) {
    return a + b;
};
let subtra = function (a, b = 0) {
    return a - b;
};
console.log(add(3, 2), subtra(3, 2));
let areaCircle = function (a, b = Math.PI) {
    return Math.pow(a, 2) * b;
};
//计算圆的面积
console.log(areaCircle(5).toFixed(2));
//默认参数,针对对象如何实现可选值
class Animal1 {
    constructor(name, age) {
        this.name = name;
        this.age = age;
    }
}
let cat = new Animal1("hanshi", 18);
//任务1，构建一个班级的对象，
//包含班级名称,人数,楼层,负责人
//其中人数和负责人是可选，实例化一个班级对象，
// 并遍历输出对象的属性和名称
class ClassObj {
    constructor(name, addr) {
        this.run = (addr) => {
            console.log(this.name + "在" + addr + "跑步");
        };
        this.name = name;
        this.addr = addr;
    }
    static eat(food) {
        console.log(this.name + "吃" + food);
    }
}
let aa = new ClassObj("AA班", "1楼");
aa.num = 20;
aa.admin = "zhangsan";
//遍历输出对象的属性和名称
let entry = Object.entries(aa);
entry.forEach(e => {
    let values = Object.values(e);
    let pname = values[0];
    let value = values[1];
    console.log(`属性名:${pname} -> ${value}`);
});
ClassObj.eat("饭");
aa.run("操场");
//函数作为函数的参数
function fun(foo, a, b) {
    console.log(foo(a, b));
}
//fun(add,1,2);
